//
//  DRHttpTool.h
//  DoctorRen
//
//  Created by Lemon on 2018/11/19.
//

#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>

@class DRResponseModel;
typedef void (^RequestFail)(NSError *error);
typedef void (^RequestSuccess)(id data);

NS_ASSUME_NONNULL_BEGIN

@interface DRHttpTool : NSObject

@property (nonatomic, readonly)  AFHTTPSessionManager *manager;
    
///返回单例
+(instancetype)shared;

///get异步请求json接口
-(void)GET:(NSString*)url andParams:(NSDictionary*)parameters andSucc:(void(^)(id data))succBlock andFail:(void(^)(NSError *error))failBlock;

///post异步请求json接口
-(void)POST:(NSString*)url andParams:(NSDictionary*)parameters andSucc:(void(^)(id data))succBlock andFail:(void(^)(NSError *error))failBlock;

//两个不同人员写的接口格式，
///get异步请求json接口
-(void)new_GET:(NSString*)url andParams:(NSDictionary*)parameters andSucc:(void(^)(id data))succBlock andFail:(void(^)(NSError *error))failBlock;

///post异步请求json接口
-(void)new_POST:(NSString*)url andParams:(NSDictionary*)parameters andSucc:(void(^)(id data))succBlock andFail:(void(^)(NSError *error))failBlock;



@end

NS_ASSUME_NONNULL_END

@interface DRResponseModel : NSObject

@property (nonatomic, assign) Boolean isError;//1请求失败 0请求成功

@property (nonatomic, assign) NSInteger error;

@property (nonatomic, strong) NSString *msg;

@property (nonatomic, strong) NSDictionary *data;

//new
@property (nonatomic, assign) NSInteger code;

@property (nonatomic, strong) NSDictionary *datas;

@end
